/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.56.111(mysql)
 Source Server Type    : MySQL
 Source Server Version : 50615
 Source Host           : 192.168.56.111
 Source Database       : beetle-auth

 Target Server Type    : MySQL
 Target Server Version : 50615
 File Encoding         : utf-8

 Date: 02/04/2017 12:25:27 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `login_token`
-- ----------------------------
DROP TABLE IF EXISTS `login_token`;
CREATE TABLE `login_token` (
  `token_id` varchar(255) NOT NULL COMMENT '本次登陆id',
  `user_id` int(11) NOT NULL,
  `user_name` varchar(255) DEFAULT NULL,
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间 即 登陆时间',
  `login_out_time` datetime DEFAULT NULL COMMENT '退出登陆时间',
  `desc` varchar(255) DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`token_id`),
  KEY `index_login_token_user_id` (`user_id`) USING BTREE,
  CONSTRAINT `fk_login_token` FOREIGN KEY (`user_id`) REFERENCES `beetle-auth`.`user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `menu`
-- ----------------------------
DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
  `menu_id` int(11) NOT NULL AUTO_INCREMENT,
  `menu_name` varchar(255) DEFAULT NULL COMMENT '菜单名称',
  `menu_url` varchar(255) DEFAULT NULL COMMENT '菜单链接地址',
  `menu_level` int(1) DEFAULT '1' COMMENT '菜单级别  一级菜单 二级菜单  阿拉伯数字 1 2',
  `menu_status` int(1) DEFAULT '0' COMMENT '菜单状态  0 可用  1 不可用',
  `parent_menu_id` int(11) DEFAULT NULL COMMENT '父菜单id',
  `menu_css` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`menu_id`),
  UNIQUE KEY `menu_name_UNIQUE` (`menu_name`),
  KEY `index_menu_parent_menu_id` (`parent_menu_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `menu`
-- ----------------------------
BEGIN;
INSERT INTO `menu` VALUES ('1', '工程管理', 'menu.project({selectProject:\'\'})', '1', '0', null, 'glyphicon glyphicon-signal'), ('2', '统一配置文件', 'menu.configFile({selectProject:\'\',selectFile:\'\',selectEnv:\'\',filterConfig:\'true\'})', '1', '0', null, 'glyphicon glyphicon-duplicate'), ('3', '跳板机', null, '1', '0', null, 'glyphicon glyphicon-send'), ('4', '跳板机配置', 'menu.jumpServerList', '2', '0', '3', 'glyphicon glyphicon-wrench'), ('5', '推送查询', 'menu.pushRecord', '2', '0', '3', 'glyphicon glyphicon-option-horizontal'), ('6', '基础配置', '', '1', '0', null, 'glyphicon glyphicon-cog'), ('7', '工程配置', 'menu.projectSet', '2', '0', '6', 'glyphicon glyphicon-th-large'), ('8', '用户管理', 'menu.userList', '2', '0', '6', 'glyphicon glyphicon-user'), ('9', '角色管理', 'menu.roleList', '2', '0', '6', 'glyphicon glyphicon-registration-mark'), ('10', '菜单管理', 'menu.new_menu', '2', '0', '6', 'glyphicon glyphicon-briefcase'), ('11', '开发云', '', '1', '0', null, 'glyphicon glyphicon-cloud'), ('12', '集群列表', 'menu.vmList', '2', '0', '11', 'glyphicon glyphicon-indent-right'), ('13', '模板', 'menu.vmTemplate', '2', '0', '11', 'glyphicon glyphicon-th'), ('14', '发版管理', '', '1', '0', null, 'glyphicon glyphicon-tasks'), ('15', '发版任务', 'menu.deploy', '2', '0', '14', 'glyphicon glyphicon-sort-by-attributes-alt'), ('16', '配置', 'menu.serverConfig', '2', '0', '14', 'glyphicon glyphicon-wrench'), ('17', '开发云2.0', 'menu.ucList', '1', '0', null, 'glyphicon glyphicon-cloud');
COMMIT;

-- ----------------------------
--  Table structure for `role`
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `role_id` int(11) NOT NULL AUTO_INCREMENT,
  `role_name` varchar(255) DEFAULT NULL,
  `desc` varchar(255) DEFAULT NULL COMMENT '角色描述',
  PRIMARY KEY (`role_id`),
  UNIQUE KEY `role_name_UNIQUE` (`role_name`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `role`
-- ----------------------------
BEGIN;
INSERT INTO `role` VALUES ('1', 'admin', '管理员'), ('2', 'dev', '开发人员'), ('3', 'qa', '测试人员'), ('4', 'ops', '运维人员'), ('5', 'audit', '虚拟机申请审核人员'), ('6', 'assign', '虚拟机申请分配人员');
COMMIT;

-- ----------------------------
--  Table structure for `role_menu`
-- ----------------------------
DROP TABLE IF EXISTS `role_menu`;
CREATE TABLE `role_menu` (
  `menu_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  PRIMARY KEY (`menu_id`,`role_id`),
  KEY `fk_role_menu_role` (`role_id`),
  CONSTRAINT `fk_role_menu_menu` FOREIGN KEY (`menu_id`) REFERENCES `beetle-auth`.`menu` (`menu_id`),
  CONSTRAINT `fk_role_menu_role` FOREIGN KEY (`role_id`) REFERENCES `beetle-auth`.`role` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `role_menu`
-- ----------------------------
BEGIN;
INSERT INTO `role_menu` VALUES ('1', '2'), ('2', '2'), ('3', '2'), ('5', '2'), ('6', '2'), ('7', '2'), ('11', '2'), ('12', '2'), ('13', '2'), ('17', '2'), ('1', '3'), ('2', '3'), ('3', '3'), ('5', '3'), ('11', '3'), ('12', '3'), ('13', '3'), ('17', '3'), ('2', '4'), ('3', '4'), ('4', '4'), ('5', '4'), ('14', '4'), ('15', '4'), ('16', '4'), ('17', '4');
COMMIT;

-- ----------------------------
--  Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `account` varchar(255) NOT NULL COMMENT '用户名',
  `realname` varchar(255) NOT NULL COMMENT '真实姓名',
  `password` varchar(255) NOT NULL,
  `role` varchar(255) NOT NULL,
  `email` varchar(255) DEFAULT NULL COMMENT '邮箱',
  `zt_user_id` varchar(255) DEFAULT NULL COMMENT '用户对应禅道账户id',
  `zt_user_account` varchar(255) DEFAULT NULL COMMENT '禅道用户名',
  PRIMARY KEY (`id`),
  UNIQUE KEY `account_UNIQUE` (`account`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `user`
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES ('1', 'admin', '管理员', '21232f297a57a5a743894a0e4a801fc3', '|1|', null, null, null);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
